const mongoose = require("mongoose");

const deviceSchema = new mongoose.Schema(
  {
    deviceID: {
      type: String,
    },
    deviceCampus:{
      type: String,
      ref: 'campus',
      required: [true, "class must have an deviceBuilding"],
    },
    deviceBuilding: {
      type: String,
      ref: 'Building',
      required: [true, "class must have an deviceBuilding"],
    },
    deviceRoom: {
      type: String,
      ref: 'Room',
      required: [true, "class must have an deviceRoom"],
    },
    deviceIP: {
      type: String,
      required: [true, "class must have an deviceIP"],
    },
    // deviceMAC:{
    //   type:String,
    //   require:[true,"class must have an deviceMAC"]
    // },
    orgName: {
      type: String,
    },
  },
  {
    toJSON: { virtuals: true },
    toObject: { virtuals: true },
  }
);

const Device = mongoose.model("Device", deviceSchema);

module.exports = Device;
